#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

class Person
{
public:
	virtual void Buy_Ticket()
	{
		cout << "Person -> Full price ticket" << endl;
	}

};

class Student : public Person
{
public:
	virtual void Buy_Ticket()
	{
		cout << "Student -> Half price ticket" << endl;
	}

};

void Func(Person& p)
{
	p.Buy_Ticket();
}

int main1()
{

	Person p;
	Student s;

	Func(p);
	Func(s);

	return 0;
}

class A
{
public:
	virtual void func(int val = 1)
	{
		cout << "A->" << val << endl;
	}
	virtual void test()
	{
		func();
	}
};


class B : public A
{
public:
	virtual void func(int val = 10)
	{
		cout << "B->" << val << endl;
	}
};

int main2()
{

	B* p = new B;
	p->test();

	return 0;
}

class C
{
	virtual C* func() { return nullptr; }

	virtual void Test1() final
	{
		cout << "test1" << endl;
	}

	virtual void Test2()
	{
		cout << "Test2() override" << endl;
	}

};

class D : public C
{
	virtual D* func() { return nullptr; }

	virtual void Test2() override
	{
		cout << "Test2" << endl;
	}
};


class E
{
public:
	virtual void func() = 0;
};

class F : public E
{
public:
	virtual void func()
	{
		cout << "class F" << endl;
	}
};

class G : public E
{
public:
	virtual void func()
	{
		cout << "class G" << endl;
	}
};

int main3()
{

	F f;
	G g;

	E* ptr = &f;
	ptr->func();

	ptr = &g;
	ptr->func();

	return 0;
}

class H
{
public:
	virtual void func()
	{
		cout << "HHHHHHH" << endl;
	}
};

class I : public H
{

};

int main()
{

	I i;
	i.func();


	return 0;
}